<?php 
if($_POST){
	function checkImg($file){
		$arr = array("gif","jpg","png","bmp","jpeg");
		$re = strrchr($file,'.');
		$re = ltrim($re,'.');
		if(in_array($re,$arr)){
			return true;
		}else{
			return false;
		}
	}
	$bool = checkImg($_POST['pics']);
}
 ?>
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8" />
	<title>Document</title>
	<style type="text/css">
		body{
			background: gainsboro;
		}
		div{
			background: url(img/1.gif) no-repeat 0px 0px;
			margin: 100px auto;
			width: 1000px;
			height: 500px;
			
		}
		div form{
			width: 300px;
			height:300px;
			color: darkgrey;
			margin: 0 auto;
			text-align: center;
			/*line-height:500px ;*/
			font-size: 50px;
		}
		div h2{
			font-family: "微软雅黑";
			color: yellow;
			margin: 0 auto;
		}
	</style>
</head>
<body>
	<div>
	 	<form action="" method="post">
	 		<input type="text" name="pics" id="" />
	 		<input type="submit" value="请输入文件名"/>
	 	</form>
	 	<h2><?php  echo isset($bool)&&$bool==1? 'true' : 'false' ?></h2>	
 	</div>
</body>
</html>